package org.zdc.zui.skin;
import nme.Assets;
import nme.display.Loader;
import nme.display.Graphics;
import nme.display.LoaderInfo;
import nme.events.Event;
import nme.net.URLRequest;
import org.zdc.zui.IComponent;
import org.zdc.zui.style.IStyle;
using StringTools;

class Background implements IStyle
{

	public static function setStyle(c:IComponent, styles:Dynamic):Void {
		var g:Graphics = c.graphics;
		
		/**
		 * 如果是字符串，则为图片，其中:或无后缀表示嵌入的资源，@表示外部加载的图片
		 */
		if (Std.is(styles, String)) {
			setBgURL(c, cast(styles, String));
		}
		
	}
	
	private static function setBgURL(c:IComponent, url:String):Void {
		//外部资源
		if (url.startsWith("@")) {
			Assets.getBitmapData(
		}
		//内嵌资源
		else if (url.startsWith(":") ||
				 (!url.startsWith("@") &&
				  !url.startsWith(":"))) {
			Asset.
		}
	}
	
}